package br.com.carrosvale.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import br.com.carrosvale.model.entity.Login;
import br.com.carrosvale.model.service.LoginService;


@Controller
@RequestMapping(value="/login")
public class LoginController {

	private LoginService loginService; 

	@RequestMapping(value="/cadastrar" ,method=RequestMethod.POST)
	public String cadastrar( Login login ){
		return "login/login";
	}
	
	@RequestMapping(method=RequestMethod.POST)
	public String verificarLogin( Login login ){
		
		
		if( login == null ){
			return "login/login";
		}
		
		
		return "home/home";
	}
	
	@RequestMapping(method=RequestMethod.GET)
	public String index( Model model ){
		model.addAttribute("login", new Login());
		return "login/login";
	}

	@Autowired
	public void setLoginService(LoginService loginService) {
		this.loginService = loginService;
	}
	
}
